package main;

import framework.Person;
import framework.PersonsFactory;
import impl.business.MatrixBiz;
import impl.game.grid.GridGame;
import impl.game.grid.QuadranglePanel;

import javax.swing.*;
import java.awt.*;
import java.util.Random;

/**
 * Date: 07.04.2008
 * Time: 18:16:41
 *
 * @author Denis DIR Rozhnev
 */
public class Gui {

    public static void main(String[] args) {
        GridGame game = new GridGame(12, 10, GridGame.Q4);
        Person[] players = new Person[12 * 10];
        Random rnd = new Random();
        for (int i = 0; i < players.length; i++) {
            players[i] = PersonsFactory.getPerson(rnd.nextInt(PersonsFactory.STRATEGIES_COUNT));
            System.out.println("Genetated:" + players[i]);
        }
//        players[0] = new Trigger();
//        players[1] = new TitForTat();
//        players[2] = new Egoist();
//        players[2] = new Stupid();
//        players[3] = new Egoist();
//        players[4] = new Altruist();
//        players[5] = new Trigger();
//        players[6] = new AntiTitForTat();
//        players[7] = new Trigger();
//        players[8] = new Egoist();
//        players[8] = new Stupid();
        MatrixBiz biz = new MatrixBiz(10, 8, 3, 0);

        game.init(players, biz);
        QuadranglePanel qp = new QuadranglePanel(game);
//        new GridPanel(game);

        int WIDTH = 730;
        int HEIGHT = 570;
        Dimension d = Toolkit.getDefaultToolkit().getScreenSize();

        JFrame frame = new JFrame("DeepWater");
        frame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        frame.getContentPane().add(qp);
        frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        frame.pack();
        frame.setVisible(true);
        frame.setLocation(d.width / 2 - WIDTH / 2, d.height / 2 - HEIGHT / 2);
        frame.setSize(WIDTH, HEIGHT);
        frame.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
        frame.validate();
        frame.repaint();
    }
}
